Repository navigation
fix(tests): exclude TS test files from chat route census and calibrate dashboard status budget for runner TMPDIR - #9215
Conversation
…e dashboard status budget for runner TMPDIR Signed-off-by: LoopX Agent <[email protected]>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, xhigh)
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
评审固定提交 25c980d500d049576469ea3106caee296b5488b5,merge base 55bae0ac55c8858a09f05fdebd3a1b7b5dcc131f。与核对时 main 55bae0ac55c8858a09f05fdebd3a1b7b5dcc131f 三方整合无冲突。
[P2 · Blocking] 递归排除 test 目录会漏扫运行时路由引用
候选按目录 basename 递归剪除所有 test 和 tests。独立 fixture 用真实 Node v24 从 src/entry.ts 导入 src/test/readiness.ts 并输出 /api/chat/capabilities。基线清点报告该模块和测试 spec,候选的清点结果为空,漏掉正在执行的应用模块。当前 diff 未增加第二个生产 owner,但这个检查会放过此类回归。 将目录排除限定到已知测试根或项目明确排除的测试目录,保留 node_modules 和测试文件后缀过滤。补一条由生产入口导入 src/test 普通模块的回归,要求清点仍能发现它。 候选位置
动机 / Motivation
路由清点应监督运行时对 /api/chat/capabilities 的引用与唯一 owner。状态预算 smoke 应接受完整的正常投影并拒绝超限负载。 基线会把 Workbench 测试里的路由字面量算入清点,25,000 字符的状态 smoke 在较长隔离路径下失败。 候选排除 TypeScript 测试文件并把 status 字符上限校准到 26,000,增加 status 超限负载反例。
在一份合成 TS 应用中执行真实模块导入,并对同一目录树运行基线与候选的原路由清点。另用真实状态 fixture 在两种 TMPDIR 长度下逐一对照两个提交。 验证范围为源码检查、Node 真实导入及状态 smoke。托管 CI 和已安装发行包没有独立查询或执行。 现有交付规则
改动思路 / Approach
状态投影与 350/27 的结构限制沿用现有入口,此轮测试只调整字符通过边界。 沿用既有唯一 owner 和状态投影。改动集中在扫描器、smoke 阈值、反例和合同说明。 排除确知的测试输入可以减少清点噪声。保留测试后缀和现有目录里的实际 Node 运行时模块,才能继续监督唯一 owner。
具体改动 / Changes
完整 diff 共 3 个文件,新增 66 行、删除 5 行。三个文件分别更新文档、预算 smoke 与架构测试。清点原有 owner、声明客户端、第二 owner 正负对照继续运行。
-
识别运行时重复引用。保留对执行链上普通 TypeScript 的路由清点。
-
排除测试噪声。已知测试 spec 不应被计为生产引用。
-
状态字符校准。目标状态 fixture 保留完整路径与结构,超大输出仍失败。
-
_web_sources。选择需要清点的 Web TypeScript 文件。 精确代码 -
test_census_flags_a_planted_second_owner。对照新增运行时声明。 精确代码 -
assert_surface。校验字符、嵌套键和顶层键。 精确代码
对主干的风险 / Risks
14 项定向检查通过。相同短 TMPDIR 下两边的状态 JSON 均为 24,479 字符。相同长 TMPDIR 下均为 25,303 字符、339 个嵌套键和 26 个顶层键,基线因 25,000 上限失败,候选通过并继续按字符上限拒绝 51,324 字符的负载。
相同 payload、不同测试阈值的对照支持本次校准。原扫描能发现运行时模块,测试 spec 也会被计算。 原 25,000 字符上限的失败可以在同一状态 fixture 复现。
我的整体评价 / Verdict
REQUEST_CHANGES。 状态预算部分通过独立对照。应先修复 route census 对运行时模块的误排除,再重新检查当前唯一 owner 的边界。
English verdict: REQUEST_CHANGES. The status-budget calibration checks out. The census skips runtime-imported modules under directories named test or tests. Limit the exclusion to verified test roots and keep an executed runtime-module control.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · Gemini · Google · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
This exact-head review of PR #9215 (9215@25c980d500d049576469ea3106caee296b5488b5) approves these two deterministic test/qualification fixes across architecture census and hot-path interface budget qualification.
动机 / Motivation
Contributors and release-qualification operators running the full test suite under pytest session isolation or sharded qualification directories hit two deterministic false failures on unchanged production behavior.
Before this fix, the chat-route single-owner census scanned TypeScript test directories (apps/workbench/packages/web/test/steward-conversation.test.ts with 4 test string literals) despite its own rule that tests restate /api/chat/capabilities on purpose, and the operator dashboard status budget (dashboard_status_json, 24,247 characters under /tmp) overflowed its 25,000-character limit under longer isolated TMPDIR prefixes (reaching 25,151 characters in pytest and 25,311 characters in sharded runners without any production payload growth); after this fix, TypeScript test directories and .test.ts/.spec.ts files are excluded from the web route census, and the dashboard_status_json ceiling is calibrated to 26,000 characters while keeping all key-count limits and oversized-payload rejection intact.
Observably, both targeted tests pass under ambient and long isolated TMPDIR environments (24,599/26,000 direct and 25,367/26,000 under a long simulated sharded TMPDIR), test_web_census_excludes_typescript_test_files explicitly guards TypeScript test pruning without weakening node_modules pruning or I/O error propagation, and an explicit oversized dashboard_status_json test confirms oversized status payloads are still rejected.
This PR touches only test census rules, the interface budget qualification smoke, and the contract document's ceiling and evidence block; it does not alter production TypeScript or Python runtime payloads, structural key ceilings (350/27), or other tests.
- Specification & architecture basis: Evaluated against the pre-PR accepted
docs/reference/contracts/interface-budget-contract.mdat55bae0ac55c8858a09f05fdebd3a1b7b5dcc131fand the route single-owner rule insidetests/architecture/test_chat_capabilities_route_single_owner.py(SINGLE-OWNER-CENSUS,BUDGET-HEADROOM-CALIBRATION,OVERSIZED-STATUS-REJECT).SINGLE-OWNER-CENSUS: Only production web runtime code restating/api/chat/capabilitiesrequires declaration inDECLARED_WEB_CLIENT_RESTATEMENTS; test directories/files (test,tests,*.test.ts,*.spec.ts) are test harness code.BUDGET-HEADROOM-CALIBRATION: Identical short-TMPDIRbaselinev2.3.0and55bae0ac55measure the exact same24,247chars (339nested,26top-level keys) fordashboard_status_json(quota_should_run_jsonshrinks19,669 -> 18,677), proving the>25,000failure is strictly longer isolatedTMPDIRfixture-root paths.OVERSIZED-STATUS-REJECT: Preserves350/27structural bounds and adds explicit assertion thatdashboard_status_jsonabove26,000chars failsassert_surface.
改动思路 / Approach
本次修改针对全量验证中暴露的两处与生产逻辑无关的确定性误报:其一,tests/architecture/test_chat_capabilities_route_single_owner.py 对 apps/ 遍历 *.ts 时仅剪枝了 node_modules 而未按文件顶部注释(L9–13)排除 TypeScript 测试目录与测试后缀;其二,examples/control_plane/hot-path-interface-budget-smoke.py 的 dashboard_status_json 在生产结构(339/350 nested keys, 26/27 top-level keys)与短 TMPDIR 字符数(24,247)与 v2.3.0 完全一致的前提下,仅因隔离测试目录前缀更长而在 runner 中突破 25,000。
PR 采取最小、可审计的精确修复边界:
- 在
_web_sources(root)中剪枝test/tests目录并跳过*.test.ts/*.spec.ts,同时新增单元测试确认排除规则生效、且保留node_modules跳过与首方目录PermissionError上抛不变。 - 遵循既有先例(#8069),保留
25,000失败事实与350/27结构上限,将dashboard_status_json.max_json_chars同步校准为26,000并更新中英双语契约文档,同时补充类似oversized_quota的oversized_status超限拒绝校验,确保上限调节不会放松真实拦截能力。
具体改动 / Changes
-
tests/architecture/test_chat_capabilities_route_single_owner.py- 在
_web_sources(root)(L55-L63)将directories[:]剪枝从{"node_modules"}扩展为{"node_modules", "test", "tests"},并对文件名增加not name.endswith((".test.ts", ".spec.ts"))。 - 全仓扫描验证:
find apps -type d \( -name test -o -name tests \)仅命中 7 个测试目录(src-tauri/tests,usage-collector/test,daemon/test,e2e/test,ext-board/test,ext-loopx/test,web/test),无任何生产.ts模块被误屏蔽;反例验证origin/main(55bae0ac55)下_route_literals在apps/会命中steward-conversation.test.ts: 4。 - 新增
test_web_census_excludes_typescript_test_files,覆盖.test.ts、.spec.ts、test/*.ts、tests/*.ts与真实src/route.ts的正反对比;既有test_web_census_never_enters_dependencies与test_web_census_does_not_hide_first_party_io_errors保持不变。
- 在
-
examples/control_plane/hot-path-interface-budget-smoke.py与docs/reference/contracts/interface-budget-contract.md- 将
SURFACE_BUDGETS["dashboard_status_json"]["max_json_chars"]从25_000校准为26_000(保留max_nested_keys: 350、max_top_level_keys: 27与完整来源路径)。 - 在
main()新增oversized_status断言(注入超出26,000的operator_note并校验assert_surface("dashboard_status_json", oversized_status)必抛出AssertionError)。 - 更新
docs/reference/contracts/interface-budget-contract.md汇总表与中英文配对证据段落(assert_contract_doc_matches_budget_table()自动校验文档表格与代码常量一致)。 - 独立复测对照:
TMPDIR=/tmp:dashboard_status_json=24,247/26,000(339/350nested,26/27top-level),quota_should_run_json=18,677/21,000(540/575,54/55)。- 默认环境
TMPDIR:dashboard_status_json=24,599/26,000。 - 模拟长路径隔离
TMPDIR(模拟分片 runner):origin/main(55bae0ac55)确定性失败(AssertionError: ('dashboard_status_json', 25127, ... max_json_chars: 25000)),exact head25c980d500以25,367/26,000通过。
- 将
独立复现验证结果 (exact head 25c980d500d049576469ea3106caee296b5488b5)
pytest -q tests/architecture/test_chat_capabilities_route_single_owner.py tests/control_plane/test_hot_path_interface_budget_fixture.py:14 passed in 8.23s(另有安装根目录node_modules后的语义扩展回归集185 passed in 49.74s)。python3 examples/control_plane/hot-path-interface-budget-smoke.py:TMPDIR=/tmp(24247/26000)、默认环境 (24599/26000)、超长模拟 runnerTMPDIR(25367/26000) 均通过并打印hot-path-interface-budget-smoke ok。- 静态与治理校验:
ruff check(涉及三文件范围)通过、mypy(17 strict files)Success: no issues found、check_rfc_bilingual.py通过、loopx canary premerge --from-git-diff --git-diff-base origin/main直接检查5/5、catalog canaries3/3(含control-plane-maintainability-ratchet-smoke.py、semantic-vocabulary-drift-smoke.py、cli-output-budget-regression-smoke.py)、risk profile smokes8/8、public boundary1/1全部通过(manual_hold_count: 0)。 - 提交 Diff 经扫描无任何私有路径、邮箱或本地隔离环境标识,DCO
Signed-off-by完整,git merge-tree HEAD origin/main干净无冲突。
对主干的风险 / Risks
- 目录名约定边界(non-blocking):
_web_sources剪枝name in {"node_modules", "test", "tests"}假设apps/下的生产.ts源码不会存放在名为test或tests的子目录中;经实测当前仓库 7 个匹配目录均确为测试目录,风险极低,后续新增前端源码遵循同目录约定即可。 - 同域兄弟模式提示(non-blocking):
apps/workbench/packages/web/src/loopx/manager.ts:88使用带代理前缀的字符串'/api/loopx/api/chat/capabilities'(非独立"/api/chat/capabilities"字面量),不在本次范围,未修改。 - PR 正文文本提示(non-blocking): 3 个仓库变更文件本身完全公开安全;PR 描述的
VerificationCLI 示例行附带了一个本地 Goal ID 参数字符串,合并后 squash commit message 建议保持不含本地 goal 参数的干净提交信息。 - 远程 CI 未查阅 (
not_consulted): 遵循评审策略wait_for_ci: false,未轮询或等待远程 GitHub Actions 状态。
我的整体评价 / Verdict
Visual review (not_applicable): No rendered presentation, dashboard TSX/CSS, or user-facing web asset changes in PR #9215 (inspected apps/ untouched in diff).
PR #9215 以极克制的改动(3 文件 +66/-5)根治了两项阻碍 v2.4.0 全量分片验证通过的确定性测试缺陷:一面使 /api/chat/capabilities Web 盘点与其注释政策一致且补充明确单测与 I/O 报错守卫,一面基于真实短/长 TMPDIR 对比数据将 dashboard_status_json 上限精准校准至 26,000 并补齐超长 status 负载拒绝校验、未松动任何结构约束与生产负载。同意合并(已遵守本地优先、不等待远程 CI 的评审策略)。
English verdict: APPROVE on exact head 25c980d: accurately excludes TypeScript test directories/files in the chat-capabilities route census with regression coverage, calibrates dashboard_status_json headroom to 26,000 for isolated runner TMPDIR length without widening structural limits, adds explicit oversized status rejection, and passes all targeted pytest suites, long-TMPDIR smoke runs, counterfactual checks, mypy, ruff, and canary premerge validation.
Summary
test,tests) and test/spec files (*.test.ts,*.spec.ts) intests/architecture/test_chat_capabilities_route_single_owner.py::_web_sources, matching its documented rule that tests/examples intentionally restate/api/chat/capabilities(adding regression testtest_web_census_excludes_typescript_test_fileswhile keepingtest_web_census_never_enters_dependenciesandtest_web_census_does_not_hide_first_party_io_errors). Resolves deterministic census failure againstapps/workbench/packages/web/test/steward-conversation.test.ts.SURFACE_BUDGETS["dashboard_status_json"]["max_json_chars"]from25_000to26_000inexamples/control_plane/hot-path-interface-budget-smoke.pyand document the evidence indocs/reference/contracts/interface-budget-contract.md:v2.3.0and head55bae0ac55measure the identical24,247chars,339nested keys, and26top-level keys under identical shortTMPDIR(zero production payload growth;quota_should_run_jsonshrank19,669 -> 18,677).effect-runtimeisolation and the sharded qualification runner, longerTMPDIRprefixes expand the complete fixture-root paths insidedashboard_status_jsonto25,151and25,311chars respectively.26,000retains689chars of runner headroom while preserving350/27structural bounds, complete fixture paths, and a new explicit oversizeddashboard_status_jsonrejection check.Verification
pytest -q tests/architecture/test_chat_capabilities_route_single_owner.py tests/control_plane/test_hot_path_interface_budget_fixture.py:14 passed in 9.48sexamples/control_plane/hot-path-interface-budget-smoke.py: direct24,599/26,000(ok), nested sharded runnerTMPDIR25,047/26,000(ok)ruff check,mypy(17strict files),check_rfc_bilingual.py(origin/main..HEAD&92271fe114..HEAD), 13-surfacerelease-readiness-doc-smoke.py,loopx check(0errors), Goal-bound CQR (personal-loopx-maintenance), andloopx canary premerge --from-git-diff --git-diff-base origin/main --goal-id personal-loopx-maintenance